package calorie.com.calorie.contact;


import com.lxh.baselibray.mvp.BasePresent;
import com.lxh.baselibray.mvp.IBaseView;
import com.lxh.baselibray.net.NetCallBack;
import com.lxh.baselibray.net.ServiceGenerator;


import calorie.com.calorie.api.ApiService;
import calorie.com.calorie.request.BaseRequest;
import calorie.com.calorie.response.ResultDTO;
import retrofit2.Call;
import retrofit2.Response;

public class UpdateBLEInfoContact {

    public static class UpdateBLEInfoPresent  {
    private IUpdateBELView iUpdateBELView;

        public IUpdateBELView getiUpdateBELView() {
            return iUpdateBELView;
        }

        public void setiUpdateBELView(IUpdateBELView iUpdateBELView) {
            this.iUpdateBELView = iUpdateBELView;
        }

        public void updateBLE(Integer userId, String bleAddress, String bleName) {
            BaseRequest request = new BaseRequest();
            request.put("userId", userId);
            request.put("bleAddress", bleAddress);
            request.put("bleName", bleName);
            ApiService service = ServiceGenerator.createService(ApiService.class);
            service.updateBLEInfo(request).enqueue(new NetCallBack<ResultDTO>() {
                @Override
                public void onSuccess(Call<ResultDTO> call, Response<ResultDTO> response) {


                    iUpdateBELView.setResultDTO(response);
                }

                @Override
                public void onFailed() {

                }
            });
        }

    }
public  interface  IUpdateBELView extends  IBaseView{

    public void setResultDTO(Response<ResultDTO> response);


}

}
